<template>
	<view>
		<view class="first">
			<view class="avaterbox">
				<view class="avater-body">
					<image :src="vuex_user.avater" mode=""></image>
				</view>
				<view class="u-flex">
					<view class="u-font-14 u-tips-color">{{vuex_user.name}}</view>
				</view>
			</view>
			<view class="salesNum u-flex">
				<view class="trade u-flex u-flex-1  ">
					<text class="num">0</text>
					<text class="name">总交易数</text>
				</view>
				<view class="release u-flex u-flex-1 ">
					<text class="num">0</text>
					<text class="name">总发布商品数</text>
				</view>
			</view>

		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="个人信息" @click="$u.route('pages/my/baseInfo')"></u-cell-item>
				<u-cell-item title="我的交易">
					<u-icon slot='icon' color="red" size="34" name="rmb-circle" />
				</u-cell-item>
				<u-cell-item title="我发布的商品">
					<u-icon slot='icon' color="blue" size="34" name="file-text" />
				</u-cell-item>
				<u-cell-item icon="star" title="商品收藏"></u-cell-item>
				<u-cell-item icon="chat" title="意见反馈"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="reload" title="退出登录" @click='logout'></u-cell-item>
			</u-cell-group>
		</view>
		<!-- 	<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="设置"></u-cell-item>
			</u-cell-group>
		</view> -->
	</view>
</template>


<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			//登录校验
			// if (!this.$u.utils.isLogin()) return

		},
		methods: {
			 logout() {
				// 	// 请求api
				// 	await this.$u.api.outLogin()

				this.$u.toast('退出成功')

				// 清除缓存的token 和用户信息
				this.$u.vuex('vuex_token', null)
				this.$u.vuex('vuex_user', {})
			
				//跳转到首页
				setTimeout(() => {
					this.$u.route({
						type: 'reLaunch',
						url: 'pages/index/index'
					})
				}, 1500)

			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #ededed;
	}

	.first {
		box-shadow: 0 2px 4px rgba(72, 72, 72, 0.5);
		background-color: #fff;

		.avaterbox {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.avater-body {
				width: 70px;
				height: 70px;
				background-color: #E4E7ED;
				margin: 30rpx 0;

				uni-image {
					width: 100%;
					height: 100%;
				}
			}
		}


	}

	.salesNum {
		height: 200rpx;
		background-color: #fff;

		.trade,
		.release {
			display: flex;
			flex-direction: column;

			.num {
				font-size: 20px;
				color: #827dfa;
				padding-bottom: 10rpx;
			}

			.name {
				font-size: 15px;
				color: #8b8b8b;
			}
		}

	}
</style>
